﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BonsaiScrum.Core.Query
{
    public class StoryReport
    {
        public virtual int Id { get; private set; }
        public virtual string Description { get; private set; }
        
        public virtual ICollection<TaskReport> Tasks { get; private set; }

        public virtual float GetPercentComplete()
        {
            return Tasks.Count == 0 ? 1 : Tasks.Count(x => x.IsComplete()) / Tasks.Count;
        }

        public virtual bool IsComplete()
        {
            return Tasks.All(x => x.IsComplete());
        }

        protected StoryReport() { }
    }
}
